import pENGINE,pSTATES
import pygame as SDL

class Pong:
    def __init__(self,width=640,height=480):
        """Initialize the pong game."""
        SDL.init()
        
        #Set the window dimensions
        self.width = width
        self.height = height
        
        #Set up the window itself
        self.screen = SDL.display.set_mode((width,height))
        SDL.display.set_caption("Retro Pong")
        
        #set up the state machine
        self.StateMachine = pENGINE.StateMachine()
        self.StateMachine.push(pSTATES.MenuState(self.screen))
        
        #And push a state onto it
    
    def GameLoop(self):
        while not self.StateMachine.isEmpty():
            self.StateMachine.run(screen=self.screen,pong=self)
            SDL.display.flip()


if __name__=="__main__":
    Game = Pong()
    Game.GameLoop()